package cn.itcast.activiti.servlet.deployment;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.RepositoryService;
import org.apache.catalina.connector.Request;

import cn.itcast.activiti.common.ProcessEngineUtils;

/**
 * 删除流程部署
 * @author LEE.SIU.WAH
 * @email lixiaohua7@163.com
 * @date 2016年5月6日 下午2:43:15
 * @version 1.0
 */
@WebServlet("/deleteProcessDeployment.action")
public class DeleteProcessDeploymentServlet extends HttpServlet{
	private static final long serialVersionUID = 2739577417695370115L;

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		String id=request.getParameter("id");
		/** 获取流程引擎 */
		ProcessEngine pe=ProcessEngineUtils.getProcessEngine();
		
		/** 获取仓储服务 */
		RepositoryService rs=pe.getRepositoryService();
		
		/** 删除流程部署 */
		rs.deleteDeployment(id,true);
		
		response.sendRedirect(request.getContextPath()+"/queryProcessDeployment.action");
	}
	

	

}
